home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8508 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.1 KB

  1. Path: kbad.eglin.af.mil!rpi!not-for-mail
  2. From: jah@cais.cais.com (John A Hughes)
  3. Newsgroups: comp.lang.c++.moderated,comp.lang.c
  4. Subject: Re: Tool for removing surplus #includes
  5. Date: 4 Mar 1996 18:22:05 -0000
  6. Organization: Capital Area Internet Service info@cais.com 703-448-4470
  7. Sender: cppmods@netlab.cs.rpi.edu
  8. Approved: Dietmar.Kuehl@uni-konstanz.de
  9. Message-ID: <4hfccd$jun@netlab.cs.rpi.edu>
  10. References: <4gj0p3$lp0@solutions.solon.com> <4gum81$hlk@netlab.cs.rpi.edu> <4h2kto$c9k@netlab.cs.rpi.edu>
  11. NNTP-Posting-Host: netlab.cs.rpi.edu
  12. X-Original-Date: 4 Mar 1996 17:07:44 GMT
  13.  
  14. In article <4h2kto$c9k@netlab.cs.rpi.edu>,
  15. Tony Houghton  <tonyh@tcp.co.uk> wrote:
  16. >In article <4gum81$hlk@netlab.cs.rpi.edu>
  17. >          nababs@qualcomm.com (Nasser Abbasi) wrote:
  18. >
  19. >> In article <4gj0p3$lp0@solutions.solon.com>, tonyh@tcp.co.uk says...
  20. >> [...desire for a tool to remove surplus #includes...]
  21. >> I think you are trying to save few nanoseconds here from the 
  22. >> pre-processor time
  23. >
  24. >It takes more than nanoseconds.
  25.  
  26. It also generates spurious dependecies that can cause entire files to be
  27. recompiled because a header file they have no interest in has been touched.
  28. If this happens in an unfortunate header file, the results of that can easily
  29. propagate through large parts of your project and waste kiloseconds.
  30.  
  31. A file should contain exactly the header files it depends on, no more and
  32. no less. If removing a #include causes you to add it somewhere else, you
  33. were relying on a non-local and confusing inclusion structure anyway, which
  34. you should be thrilled to have exposed. And why should one expect changing
  35. a header file not to "break" code that includes it anyway? 
  36.  
  37. I *hate* it when people give me libraries that insist I include something in
  38. order to include their file, or have to put includes in a certain order. It's
  39. stupid and unnecessary if you follow the simple rule above.
  40.  
  41.  
  42. jah
  43.  
  44.       [ Articles to moderate: mailto:c++-submit@netlab.cs.rpi.edu ]
  45.       [  Read the C++ FAQ: http://www.connobj.com/cpp/cppfaq.htm  ]
  46.       [  Moderation policy: http://www.connobj.com/cpp/guide.htm  ]
  47.       [      Comments? mailto:c++-request@netlab.cs.rpi.edu       ]
  48.